package com.nwpu.coursesupport.view.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.nwpu.coursesupport.controller.AbstractController;
import com.nwpu.coursesupport.entity.bean.JSONResult;

@Controller
@RequestMapping("/taskDetailStuView")
public class TaskDetailStuViewController extends AbstractController{

	@RequestMapping("/taskMainDetail")
	public String taskMainDetail(@RequestParam("id")int id,HttpServletRequest request){
		JSONResult rst=invokeService("taskDetailStuView", "taskMainDetail", "{\"id\":\"" + id + "\"}");
		request.setAttribute("data",this.parseData(rst));
		return "";
	}
	
	@RequestMapping("/ajaxTaskMainDetail")
	@ResponseBody
	public JSONResult ajaxTaskMainDetail(@RequestParam("id")int id){
		JSONResult rst=invokeService("taskDetailStuView", "taskMainDetail", "{\"id\":\"" + id + "\"}");
		return rst;
	}
	
	@RequestMapping("/taskInLessonDetail")
	public String taskInLessonDetail(@RequestParam("id")int id,HttpServletRequest request){
		JSONResult rst=invokeService("taskDetailStuView", "taskInLessonDetail", "{\"id\":\"" + id + "\"}");
		request.setAttribute("data",this.parseData(rst));
		return "";
	}
	
	@RequestMapping("/ajaxTaskInLessonDetail")
	@ResponseBody
	public JSONResult ajaxTaskInLessonDetail(@RequestParam("id")int id){
		JSONResult rst=invokeService("taskDetailStuView", "taskInLessonDetail", "{\"id\":\"" + id + "\"}");
		return rst;
	}
	
	@RequestMapping("/taskPersonalDetail")
	public String detail(@RequestParam("id")int id,HttpServletRequest request){
		JSONResult rst=invokeService("taskDetailStuView", "taskPersonalDetail", "{\"id\":\"" + id + "\"}");
		request.setAttribute("data",this.parseData(rst));
		return "";
	}
	
	@RequestMapping("/ajaxTaskPersonalDetail")
	@ResponseBody
	public JSONResult ajaxDetail(@RequestParam("id")int id){
		JSONResult rst=invokeService("taskDetailStuView", "taskPersonalDetail", "{\"id\":\"" + id + "\"}");
		return rst;
	}
	
}
